package com.jd.basic.config;

import com.jd.basic.intercepto.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author 小林同学
 * @version 1.0
 * @description: TODO
 * @date 2023/3/6 19:10
 */
@Component
public class LoginConfig implements WebMvcConfigurer {

    @Autowired
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 添加拦截器

        registry.addInterceptor(loginInterceptor)
                // 拦截所有路径
                .addPathPatterns("/**")
                // 设置放行路径
                .excludePathPatterns("/login/**",
                        "/shop/settlement/**",
                        "/shop/echarts/**",
                        "/verifyCode/**",
                        "/fastDfs/**",
                        "/shop/audit/**");



    }
}
